$(function(){
  $('#submit').click(function(e){
      e.preventDefault()
      var name=$('#name').val()
      var password=$('#password').val()
      $.ajax({
          type: "post",
          url: "./login",
          data: {name:name, password:password},
          dataType: "json",
          jsonpCallback:"jsonpCallback",
          success: function(data){
              console.log(data)
              if(data.massge=='0'){
                  window.location.href='/student'
              }else if(data.massge=='1'){
                  alert('密码输入有误')
              }else if(data.massge=='2'){
                  alert('用户名输入有误')
              }
          }
      });
  })



})














// // 这里使用最原始的js语法实现，可对应换成jquery语法进行逻辑控制
//    var visible=document.getElementById('psw_visible');//text block
//    var invisible=document.getElementById('psw_invisible');//password block
//    var inputVisible = document.getElementById('input_visible');
//    var inputInVisible = document.getElementById('input_invisible');
// //隐藏text block，显示password block
//    function showPsw(){
//        var val = inputInVisible.value;//将password的值传给text
//        inputVisible.value = val;
//        invisible.style.display = "none";
//        visible.style.display = "";
//    }
// //隐藏password，显示text
//    function hidePsw(){
//        var val=inputVisible.value;//将text的值传给password
//        inputInVisible.value = val;
//        invisible.style.display = "";
//        visible.style.display = "none";
//    }
// // https://blog.csdn.net/m0_37909187/article/details/79280545
